package com.example.MyThread.waitandontify;

import java.util.concurrent.ArrayBlockingQueue;

/**
 * @author Jason
 * @PACKAGE_NAME com.example.MyThread.waitandontify01
 * @Description 消费者
 * @date 2023-12-10 22:12
 */
public class Foodie extends Thread {
    ArrayBlockingQueue<String> queue;

    public Foodie(ArrayBlockingQueue<String> queue) {
        this.queue = queue;
    }

    @Override
    public void run() {
        while (true) {
            try {
                String food = queue.take();
                System.out.println(food);
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
        }
    }
}
